﻿using ClassLibrary;
using System;
using System.Collections.Generic;

namespace ConsoleDemo
{
    public class NewFeature
    {
        public static void NewFeatureDemo()
        {
            // 01.带默认值参数函数
            FuncWithDefaultPara();
            // 02.省略一个默认参数调用
            FuncWithDefaultPara(10086);

            InitialPropertyFunc();
        }

        static void FuncWithDefaultPara(int id = 10010, bool gender = true)
        {
            Console.WriteLine("Id:{0},Gender:{1}", id,
                gender ? "Man" : "Woman");
        }

        static void InitialPropertyFunc()
        {
            Person p = new Person() { Name = "小强", Age = 18 };
            Console.WriteLine("Name:{0}-Age:{1}", p.Name, p.Age);

            List<Person> personList = new List<Person>()
            {
                new Person(){Name="小强",Age=10},
                new Person(){Name="小王",Age=15},
                new Person(){Name="小李",Age=18}
            };

            foreach (Person person in personList)
            {
                Console.WriteLine("Name:{0}-Age:{1}",
                    person.Name, person.Age);
            }
        }
    }
}
